package com.xuecheng.content.convert;

import com.xuecheng.api.content.model.dto.CourseBaseDTO;
import com.xuecheng.api.content.model.vo.CourseBaseVO;
import com.xuecheng.content.entity.CourseBase;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;


/**
 * @author 黄子弟
 * @Date 2021/12/8
 */

@Mapper
public interface CourseBaseConvert {

    CourseBaseConvert INSTANCE = Mappers.getMapper(CourseBaseConvert.class);
    //将po转换为dto
    @Mapping(source = "id", target = "courseBaseId")
    CourseBaseDTO entity2dto(CourseBase courseBase);

    //将vo转换为dto
    CourseBaseDTO vo2dto(CourseBaseVO courseBaseVO);

    //将dto转换为po
    @Mapping(source = "courseBaseId",target = "id")
    CourseBase dto2entity(CourseBaseDTO courseBaseDTO);



    //将pos转换为dtos
    List<CourseBaseDTO> entitys2dtos(List<CourseBase> courseBases);

}
